package variabilitysmelldetection.measurement.measures.spl;

import java.util.List;

import variabilitysmelldetection.measurement.measures.Measure;
import variabilitysmelldetection.measurement.measures.component.NumberOfOperationOverrides;
import variabilitysmelldetection.measurement.models.ComponentItem;
import variabilitysmelldetection.measurement.models.MethodItem;


public class TotalNumberOfOperationOverrides extends Measure {

	
	public TotalNumberOfOperationOverrides() {
		super("Total Number of Operation Overrides", "TNOOr");
	}

	@Override
	public void measure(List<ComponentItem> items) {
		int value = 0;
		for (ComponentItem classe : items) {
			List<MethodItem> methods = classe.getMethods();
			for (MethodItem method : methods) {
				Measure m = method.getMeasure(NumberOfOperationOverrides.class);
				if (m != null) {
					value += m.getValue();
				}
			}
		}
		setValue(value);
	}	
}
